package cn.edu.scau.cmi.zeyang.multiton;

import java.util.HashSet;

public class Multiton {

	private static HashSet<Multiton> multitons;
	private String name;

	public String getName() {
		return name;
	}

	private Multiton(String name){
		this.name = name;
	}

	public static HashSet<Multiton> getInstance(){
		if(multitons==null){
			multitons = new HashSet<Multiton>();
		}
		return multitons; 
	}

	public static HashSet<Multiton> addObject(String name){
		if(multitons.size()<10){
			multitons.add(new Multiton(name));
		}
		return multitons;
	}

}
